package com.boer.filedemo.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.boer.filedemo.entity.MyFile;
import com.boer.filedemo.service.MyFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/***
 * 获取文件元数据接口
 */
@RestController
public class ReturnController {
    @Autowired
    MyFileService service;

    @GetMapping("returnMyFile")
    public MyFile returnMyFile(@RequestParam("uuid") String uuid) {
        //根据uuid从数据库查出文件的元数据
        QueryWrapper<MyFile> wrapper = new QueryWrapper<>();
        wrapper.eq("uuid", uuid);
        MyFile myFile = service.getOne(wrapper);
        return myFile;
    }
}
